import { GetMoveDetail, GetMoveUrl } from "apis/index";
Page({
  data: {
    id: "",
    info: {},
    src:
      "http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400",
  },

  onLoad(options) {
    const { id } = options;
    this.setData({
      id,
    });
    this.getMoveDetail();
    this.getMoveUrl();
  },

  onShareAppMessage() {},
  getMoveDetail() {
    const { id } = this.data;
    GetMoveDetail({ mvid: id }).then((res) => {
      console.log(res, "res-info---");
      this.setData({
        info: res || {},
      });
    });
  },
  getMoveUrl() {
    const { id } = this.data;
    GetMoveUrl({ id }).then((res) => {
      this.setData({
        src: res.url,
      });
    });
  },
  onEnterPicture() {
    console.log("进入小窗模式");
  },

  onLeavePicture() {
    console.log("退出小窗模式");
  },

  onPlayVideo() {
    console.log("1");
    this.videoContext.play();
  },
  bindSendDanmu() {
    this.videoContext.sendDanmu({
      text: this.inputValue,
      color: getRandomColor(),
    });
  },

  onError(e) {
    console.log("视频错误信息:");
    console.log(e.detail.errMsg);
  },
});
